<?php

class Site_model extends ci_controller {


function _construct()
	{
		//parent::ci_controller();
		$this->is_logged_in();
	}	









/*function index()

				{
					
					
				$data=array();
				//$this->load->model('Site_model');
				if ($q=$this->Site_model->get_adverts()) 
				{$data['adverts']=$q;}
				$this->load->view('home', $data );
			   }




function create_advert()
				{
				$data=array(
				
				'title'=>$this->input->post('title'),
				'content'=>$this->input->post('content')
				);
				
				$this->Site_model->add_advert($data);
				$this->index();
				}

function delete_advert()
				{
					
				$this->Site_model->delete_advert()	;
				$this->index();
				
				}
				
function update_advert()

				{
				$data=array(
				
				'title'=>'my new title',
				'content'=>'new content'
				
				);	
					
				$this->Site_model->update_advert($data);
				$this->index();
				
				
				}*/
function admin_area()
					{
						$this->load->view('logged_in_area');
					}
				
function is_logged_in()
	{
		$is_logged_in = $this->session->userdata('is_logged_in');
		if(!isset($is_logged_in) || $is_logged_in != true)
		{
			echo 'You don\'t have permission to access this page. <a href="../login">Login</a>';	
			die();	
			//$this->load->view('login_form');
		}		
	}					
}
?>